package com.atlansheng.rocketmqdemoboot.demos.consumer;

import com.alibaba.fastjson.JSON;
import com.atlansheng.rocketmqdemoboot.demos.Dto.MsgInfo;
import com.atlansheng.rocketmqdemoboot.demos.po.OneJifen;
import com.atlansheng.rocketmqdemoboot.demos.po.OneOrder;
import com.atlansheng.rocketmqdemoboot.demos.service.JiFenService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.annotation.SelectorType;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @ClassName: DelayTopic02Consumer
 * @Description:
 * @Date 2024/05/09 09:55
 * @Author songshaoqiu
 **/
@Service
@Slf4j
@RocketMQMessageListener(topic = "delay-topic-02",consumerGroup ="dalay_group" ,selectorExpression = "delay_tag || TAG2",selectorType = SelectorType.TAG)
public class DelayTopic02Consumer implements RocketMQListener<String> {
    @Autowired
    private JiFenService jiFenService;
    @Override
    @Transactional
    public void onMessage(String message) {
        log.info("消费延迟消息,{}",message);
        MsgInfo msgInfo = JSON.parseObject(message, MsgInfo.class);
        System.out.println(msgInfo);

    }
}
